<?php

class RbisSpeciesTable extends Doctrine_Table
{

  public function getSpeciesById($id)
  {
    $q = Doctrine_Query::create()
    ->from('RbisSpecies s')
    ->where('s.id = ?', $id)
    ->limit(1);


    return $q->execute();
  }

  public function getSpeciesList($idList, Doctrine_Query $q = null)
  {
    if (is_null($q))
    {
      $q = Doctrine_Query::create()
      ->from('RbisSpecies s');
    }
    $q->wherein('s.id', $idList);

    return $q->execute();
  }

  public function getSpeciesBasic(Doctrine_Query $q = null)
  {
    if (is_null($q))
    {
      $q = Doctrine_Query::create()
      ->from('RbisSpecies s');
    }
    $q->select('s.id, s.category_id, s.name');

    return $q->fetchArray();
  }

}